package fanxing;

import java.util.Comparator;
import java.util.TreeSet;

public class treeSet {
    public static void main(String[] args) {
        TreeSet<Student> treeSet = new TreeSet<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                int result = o1.getAge()-o2.getAge();
                if (result==0){
                    result=o1.getName().compareTo(o2.getName());
                }
                return result;
            }
        });
        treeSet.add(new Student("东平",154858));
        treeSet.add(new Student("dbb",1564));
        treeSet.add(new Student("cbb",1564));
        treeSet.add(new Student("♪(･ω･)ﾉ",185));
        System.out.println(treeSet);
    }
}
